#include <string>

using namespace std;

typedef enum {
    Comment, LBrace, RBrace, LAngle, RAngle, LParen, RParen,
    Comma, Camera, Light, Sphere, Plane, Box, Triangle, Cone,
    Pigment, Color, RGB, RGBF, Finish, Translate, Rotate, Scale,
    Ambient, Diffuse, Specular, Roughness, Reflection, Refraction, IOR,
    Location, Up, Right, LookAt, Eof
} Token;


/* since enumerations are essentially just numbers, we can use their names
   as data elements for an array */
string tokenList[] = {"//", "{", "}", "<", ">", "(", ")", ",", "camera",
    "light_source", "sphere", "plane", "box", "triangle", "cone",
    "pigment", "color", "rgb", "rgbf", "finish", "translate", "rotate",
    "scale", "ambient", "diffuse", "specular", "roughness", "reflection",
    "refraction", "ior", "location", "up", "right", "look_at", "EOF", ""};

//is either a token or a variable (a number for this language)
struct Symbol {
    bool isToken;
    Token t;
    float num;
};


Token lookUpToken(string s) {
    int i = 0;
    while (tokenList[i].compare("") != 0) {
        if (s.compare(tokenList[i]) == 0) {
            return (Token) i;
        }

        i++;
    }

    if (strtol(s.c_str(), NULL, 10) == 0) {
        return Eof;
    }
    cout << "Unknown token: \"" << s << "\"" << endl;
    exit(1);
}

string lookUpName(Token t) {
    return tokenList[t];
}
